
<h1>Products </h1>
<div style="background-image: url(<?= $this->baseUrl() ?>/images/pop.gif);display: none;width:150px;height: 50px;z-index: 100" id="pop"></div>
<div style="background-color: cadetblue;padding-left: 10px;display: none;width:250px;height: 250px;z-index: 100" id="pop2"></div>
<table border="0">
    <?php
    $i = 0;
    $datas = $this->data;
    foreach ($this->data as $data) {//
        $flagOpenTr = false;
        $flagCloseTr = false;

        if ($i % 3 == 0) {
            $flagOpenTr = true;
        } elseif (($i + 1) % 3 == 0) {
            $flagCloseTr = true;
        }
        if ($flagOpenTr) {
    ?>
            <tr>
    <?php
        }
        //$tdNumber = 3 ? (($i+3)<sizeof($this->data)) : (sizeof($this->data)-$i);
//                        if(($i+3)<sizeof($this->data))
//                                $tdNumber=3;
//                        else
//                                $tdNumber=(sizeof($this->data)-$i);
//
//                        for($j=0;$j<$tdNumber;$j++)
//                        {
    ?>
        <td>


            <div class="divcss">
                <div class="divTitle"> <?= $data['name'] ?> </div>
                <div class="divImage">
                    <a href="<?php echo $this->url(array("url" => $data['id'], "action" => "show", "controller" => "product")) ?>">
                        <img src="<?= $this->baseUrl() ?>/product_images/<?= $data['image'] ?>" width="100" height="100" />
                    </a>
                </div>
                <div class="divPrice"> <?= $data['price'] ?> $ </div>
                <a href="" class="divButton" rel="<?= $data['id'] ?>" id="addtoshoping"></a>
            </div>

        </td>
<?php
        //   }
        if ($flagCloseTr) {
?>
        </tr>
<?php
        }
        $i++;
    }
?>
</table>
<?php
    echo $this->paginationControl($this->data,
            'Sliding',
            'partials/pagination-control.phtml');
?>